package com.lbt.educms.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.lbt.educms.entity.CrmBanner;
import com.lbt.educms.mapper.CrmBannerMapper;
import com.lbt.educms.service.CrmBannerService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 首页banner表 服务实现类
 * </p>
 *
 * @author testjava
 * @since 2020-06-05
 */
@Service
public class CrmBannerServiceImpl extends ServiceImpl<CrmBannerMapper, CrmBanner> implements CrmBannerService {

    @Override
    public List<CrmBanner> selectAllList() {
        //根据ID 进行降序排列 只显示前两条记录
        System.out.println("我执行了");
        QueryWrapper<CrmBanner> wrapper=new QueryWrapper<>();
        wrapper.orderByDesc("id"); //降序排列
        wrapper.last("limit 2"); //拼接 sql  语句 只显示两条语句
        List<CrmBanner> list = baseMapper.selectList(wrapper);
        return list;
    }
}
